import java.security.*;

public class Hash {

	public static String getHashText(String text) {
		String algorithm = "SHA-1";
		MessageDigest md = null;
		try {
			md = MessageDigest.getInstance(algorithm);
		} catch(NoSuchAlgorithmException e) {
			System.out.println(e.getMessage());
		}
		md.update(text.getBytes());
		byte[] digest = md.digest();
		StringBuffer hex = new StringBuffer();

		for(int i=0; i<digest.length; i++) {
			text = Integer.toHexString(0xFF & digest[i]);
			if(text.length()<2) {
				text = "0" + text;
			}
			hex.append(text);
		}
		return hex.toString();
	}

}